# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Jobs.V3.Model.ClientEvent do
  @moduledoc """
  An event issued when an end user interacts with the application that implements Cloud Talent Solution. Providing this information improves the quality of search and recommendation for the API clients, enabling the service to perform optimally. The number of events sent must be consistent with other calls, such as job searches, issued to the service by the client.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Required. The timestamp of the event.
  *   `eventId` (*type:* `String.t`, *default:* `nil`) - Required. A unique identifier, generated by the client application. This `event_id` is used to establish the relationship between different events (see parent_event_id).
  *   `extraInfo` (*type:* `map()`, *default:* `nil`) - Optional. Extra information about this event. Used for storing information with no matching field in event payload, for example, user application specific context or details. At most 20 keys are supported. The maximum total size of all keys and values is 2 KB.
  *   `jobEvent` (*type:* `GoogleApi.Jobs.V3.Model.JobEvent.t`, *default:* `nil`) - A event issued when a job seeker interacts with the application that implements Cloud Talent Solution.
  *   `parentEventId` (*type:* `String.t`, *default:* `nil`) - Optional. The event_id of an event that resulted in the current event. For example, a Job view event usually follows a parent impression event: A job seeker first does a search where a list of jobs appears (impression). The job seeker then selects a result and views the description of a particular job (Job view).
  *   `requestId` (*type:* `String.t`, *default:* `nil`) - Required. A unique ID generated in the API responses. It can be found in ResponseMetadata.request_id.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :eventId => String.t() | nil,
          :extraInfo => map() | nil,
          :jobEvent => GoogleApi.Jobs.V3.Model.JobEvent.t() | nil,
          :parentEventId => String.t() | nil,
          :requestId => String.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:eventId)
  field(:extraInfo, type: :map)
  field(:jobEvent, as: GoogleApi.Jobs.V3.Model.JobEvent)
  field(:parentEventId)
  field(:requestId)
end

defimpl Poison.Decoder, for: GoogleApi.Jobs.V3.Model.ClientEvent do
  def decode(value, options) do
    GoogleApi.Jobs.V3.Model.ClientEvent.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Jobs.V3.Model.ClientEvent do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
